#ifndef PAGING_H
#define PAGING_H

typedef struct
{
	u32int* page_directory;
	u32int* page_tables[1024];//this declares 1024 pointers to tables
}address_space_t;

void initialize_paging(void);

// Returns a pointer to the new address space.
address_space_t* create_address_space(void);

// Destroys an address space freeing all of its resources.
s32int destroy_address_space(address_space_t* space);

// Switches to the given address space.
s32int switch_address_space(address_space_t* space);

//Turns off paging completely
void disable_paging(void);

//maps the given address range in the given address space to the given physical address
s32int map_address_range(address_space_t *space, u32int virt_addr_start, u32int virt_addr_end, u32int phys_addr);

s32int page_alloc(address_space_t *space, u32int virt_addr_start, u32int virt_addr_end);

u32int id_page_alloc(u32int size);

//frees the pages between and including the given addresses
s32int page_free(address_space_t* space, u32int virt_addr_start, u32int virt_addr_end);

#endif
